﻿#region File Description
//-----------------------------------------------------------------------------
//Car.cs
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
#endregion

namespace ProjectTerra
{
    enum CarStatus
    {
        Unsold=1, InRepair, Pending, Sold
    };

    enum CarType
    {
        Sedan=1, Coupe, SUV, MinivanorVan, Wagon, Crossover, Convertible, Hatchback, Truck, Hybrid, Diesel
    };    
    
    class Car
    {
        #region Fields

        string make;
        string model;
        string condition;
        string enginetype;
        string fueltype;
        string transmission;
        string drivetype;
        string excolor;
        string incolor;
        string features;
        string warranty;
        string info;
        int year;
        int vin;
        int mileage;
        int horsepower;
        int torque;
        int cityfe;
        int highwayfe;
        int status;
        int vehicletype;
        float tag_price;
        float lowest_sale_price;
        List<Discount> discounts;
        DateTime recieved;
        Dealership at_dealer;

        #endregion

        #region Constructors

        public Car()
        {
            year = 1000;
            make = "";
            model = "";
            enginetype = "";
            fueltype = "";
            transmission = "";
            drivetype = "";
            features = "";
            warranty = "";
            info = "";
            condition = "";
            excolor = "";
            incolor = "";
            vin = 0;
            mileage = 0;
            tag_price = 0;
            lowest_sale_price = 0;
            horsepower = 0;
            torque = 0;
            cityfe = 0;
            highwayfe = 0;
            discounts.Clear();
            status = (int)CarStatus.Unsold;
            vehicletype = 0;
            at_dealer = new Dealership();
            discounts = new List<Discount>();
        }

        #endregion

        #region Properties

        public int Year
        {
            get
            {
                return year;
            }
            set
            {
                year = value;
            }
        }

        public string Make
        {
            get
            {
                return make;
            }
            set
            {
                make = value;
            }
        }

        public string Model
        {
            get
            {
                return model;
            }
            set
            {
                model = value;
            }
        }

        public int VIN_Number
        {
            get
            {
                return vin;
            }
            set
            {
                vin = value;
            }
        }

        public string EngineType
        {
            get { return enginetype; }
            set { enginetype = value; }
        }

        public string fuelType
        {
            get { return fueltype; }
            set { fueltype = value; }
        }

        public string Transmission
        {
            get { return transmission; }
            set { transmission = value; }
        }

        public string DriveType
        {
            get { return drivetype; }
            set { drivetype = value; }
        }

        public string Condition
        {
            get
            {
                return condition;
            }
            set
            {
                condition = value;
            }
        }

        public int Mileage
        {
            get
            {
                return mileage;
            }
            set
            {
                mileage = value;
            }
        }

        public int Horsepower
        {
            get { return horsepower; }
            set { horsepower = value; }
        }

        public int Torque
        {
            get { return torque; }
            set { torque = value; }
        }

        public int CityFE
        {
            get { return cityfe; }
            set { cityfe = value; }
        }

        public int HighwayFE
        {
            get { return highwayfe; }
            set { highwayfe = value; }
        }

        public int Status
        {
            get
            {
                return status;
            }
            set
            {
                status = value;
            }
        }

        public int VehicleType
        {
            get { return vehicletype; }
            set { vehicletype = value; }
        }

        public string exColor
        {
            get { return excolor; }
            set { excolor = value; }
        }

        public string inColor
        {
            get { return incolor; }
            set { incolor = value; }
        }

        public string Features
        {
            get { return features; }
            set { features = value; }
        }

        public string Warranty
        {
            get { return warranty; }
            set { warranty = value; }
        }

        public float TagPrice
        {
            get
            {
                return tag_price;
            }
            set
            {
                tag_price = value;
            }
        }

        public Dealership Location
        {
            get
            {
                return at_dealer;
            }
            set
            {
                at_dealer = value;
            }
        }

        public string CarInfo
        {
            get
            {
                return info;
            }
            set
            {
                info = value;
            }
        }

        //Change to claculate from tag price?
        public float LowestSalePrice
        {
            get
            {
                return lowest_sale_price;
            }
            set
            {
                lowest_sale_price = value;
            }
        }

        public void AddDiscount(Discount add_me)
        {
            //check if in already? duplicates?
            for (int i = 0; i < discounts.Count; i++)
            {
                if (discounts[i] == add_me)
                    break;          //Inform user that duplicates exist
                else
                    discounts.Add(add_me);
            }
        }
        public void RemoveDiscount(Discount remove_me)
        {
            discounts.Remove(remove_me);
        }
        public void RempoveAllDiscounts()
        {
            discounts.Clear();
        }
        
        float PriceAfterIncentives()
        {
            return tag_price;// - incentives
        }

        public DateTime DateReceived
        {
            get { return recieved; }
            set { recieved = value; }
        }


        #endregion
    }
}
